<?php
/**
 * Created by PhpStorm.
 * User: XYX
 * Date: 2017/8/30
 * Time: 19:31
 */

namespace App\Api\Transformers;


use App\Reply;
use League\Fractal\TransformerAbstract;

class ReplyforCommentTransformer extends TransformerAbstract
{
    protected $defaultIncludes = ['consumer'];
    public function transform(Reply $item){
        return[
            'id'=>$item['id'],
            'content'=>$item['content'],
        ];
    }
    public function includeConsumer(Reply $item){
        if (! ($item->consumer)) {
            return $this->null();
        }
        return $this->item($item->consumer, new TwitterConsumerTransformer());
    }

}